<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" session="false" %>
<%@ page import="com.atozsoft.commonutil.Constants"%>
	
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- 
  - Author(s): houfy
  - Date: 2015-13-32 13:36:36
  - Description:
-->
<head>
	<%@include file="/common.jsp"%>
	<%@include file="/common/common.jsp"%>
	<%@include file="/coframe/tools/skins/common.jsp" %>
	<title>系统日志一览</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
</head>
<body>
	<div class="search-condition">
		<a href="#" class="searchclose"></a>
		<div class="list">
        	<div id="systemLogForm">
	        	<table style="width:100%;" class="table">
	            	<tr>
	              		<td class="tit" style="width:120px">
	              			操作者：
	              		</td>
	              		<td>
	                		<input class="nui-textbox" id="empName" name="criteria._expr[1].empname" vtype="maxLength:128"/>
	                		<input class="nui-hidden" name="criteria._expr[1]._op" value="like"/>
	                		<input class="nui-hidden" name="criteria._expr[1]._likeRule" value="all"/>
	              		</td>
	              		<td class="tit" style="width:120px">
	              			操作时间：
	      				</td>
		             	<td>
		             	    <input class="nui-datepicker" id="startDate" name="criteria._expr[2].comdate" allowInput="false" onvalidation="onDateValidation"/> - <input id="endDate" class="nui-datepicker" name="criteria._expr[3].comdate" allowInput="false" onvalidation="onDateValidation"/>
	                		<input class="nui-hidden" name="criteria._expr[2]._op" value=">=" />
	                		<input class="nui-hidden" name="criteria._expr[3]._op" value="<=" />
						</td>
	            	</tr>
          		</table>
          		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="search-btn-area">
				  <tr>
				     <td>
				      	<a class="nui-button" iconCls="icon-search" onclick="search">查询</a>&nbsp;&nbsp;
				      	<a class="nui-button" iconCls="icon-reload" onclick="clear">清空</a>
				     </td>
				  </tr>
	          	</table>
        	</div>
     	</div>
	 </div>
	 <div class="nui-fit">
	    <div id="systemLogGrid" class="nui-datagrid" style="width:100%;height:100%;"
  		 url="com.atozsoft.commonutil.systemLog.querySystemLogList.biz.ext" idField="systemlogid" dataField="systemLogs"
          	sizeList=[10,20,50,100] multiSelect="true" pageSize="20" allowAlternating="true">
        	<div property="columns" >
        		<div field="systemlogid" visible="false"></div>
          		<div field="empname" allowSort="true" headerAlign="center">
            		操作者
          		</div>
          		<div field="operatedate" allowSort="true" headerAlign="center"  dateFormat="yyyy-MM-dd HH:mm:ss">
        			操作时间
          		</div>
          		<div field="module" allowSort="true" headerAlign="center">
            		模块名称
      			</div>
          		<div field="function" allowSort="true" headerAlign="center">
            		功能名称
          		</div>
          		<div field="type" allowSort="true" headerAlign="center" renderer="itname">
            		操作类型
          		</div>
          		<div field="content" allowSort="true" headerAlign="center">
            		操作内容
          		</div>
          		<div field="ip" allowSort="true" headerAlign="center">
            		IP地址
          		</div>
          </div>
	   </div>
	</div>
    <script>
		// 一览行数据字典显示相关
  		function itname(e)
  		{
        	var dictText="";
        	// 操作类型
        	if (this.field=="type"){
        		dictText = nui.getDictText("<%=Constants.SYS_SYSTEMLOG_TYPE%>", e.row.type);
        		return dictText;
    		}
      	}
      	
		// 结束日期不能小于开始日期检查
		function onDateValidation(e)
		{
			if (e.isValid) {
				var startDate = nui.get("startDate").getValue();
				var endDate = nui.get("endDate").getValue();
				if(startDate != null && startDate != "" && endDate != null && endDate != ""){
	                if (startDate > endDate) {
	                    e.errorText = "结束日期不能小于开始日期！";
	                    e.isValid = false;
	                }
                }
            }
		}
	</script>
	<script type="text/javascript">
    	nui.parse();
    	// 初始化系统日志Form
		var systemLogForm = new nui.Form("#systemLogForm");
		// 初始化列表系统日志控件
    	var systemLogGrid = nui.get("systemLogGrid");
    	// 系统日志列表控件加载
  		systemLogGrid.load();
  		// 系统日志列表默认排序条件
  		systemLogGrid.sortBy("operatedate", "desc");
  		
  		//各种监听事件
	    $(document).ready(
			function(){
			   //收起查询窗口
			   $(".search-condition .searchclose").click(function(){
			  		$(".search-condition .list").toggle();
					setTimeout("nui.layout()", 10 );
			   });
			}
		);
		
    	// 查询按钮
  		function search(){
			var data = systemLogForm.getData(true,true);
    		systemLogGrid.load(data);
  		}
  		
  		// 清空按钮
	  	function clear(){
			systemLogForm.reset();
	  	}
  		
  		// 回车执行查询
  		function onKeyEnter(e) {
    		search();
  		}	
    </script>
</body>
</html>